package edu.intprog.mail;

/**
 * GreetingMailer
 *
 *	This class is used for sending the greeting emails for which the
 * e-greeting recipients will receive.
 * The sent email will contain a link to the "greeting"
 */
public class GreetingMailer extends BaseMailer {

	static final String _subject = "E-Greeting: A new greeting is waiting for you!";
	public static final String _greetingIdParamName = "GID";
	private String _gid;
	private String _senderName;
	
	public GreetingMailer(String senderEmail, String recipientEmail, String gid, String senderName) {
		super(senderEmail,recipientEmail);
		_gid = gid;
		_senderName = senderName;
	}
	
	/**
	 * buildMessageBody
	 * 
	 * this function create the activation mail body.
	 * 
	 * @param userAddr - user address for activation
	 * @param activationURL - referring servlet url that will handle the activation
	 * @return email body string
	 */
	public String buildMessageBody(String activationURL)
	{
		String message = "Hi, <br/> You got a new greeting from "+_senderName+ " which is waiting for you in the E-Greeting site.<br/><br/>" +
				"In order to view the greeting, please <a href=\"";
		message = message + activationURL + "?" + _greetingIdParamName + "=" + _gid;
		message = message + "\">click here</a>.<br/><br/>Thanks,<br/>" + _senderName;
		return message;
	}
	
	public String get_subject() {
		return _subject;
	}
}
